/**
 *
 * Copyright 2016-present teaming
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import { connect } from 'react-redux';
import { Text, StyleSheet } from 'react-native';
import { bindActionCreators } from 'redux';

// import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
// import icoMoonConfig from '../config/icoMoonConfig.json';
// const Icon = createIconSetFromIcoMoon(icoMoonConfig);

import TeamSetting from '../pages/TeamSetting/TeamSetting';
import * as teamCreators from '../actions/team';


class TeamSettingContainer extends React.Component {

  static navigationOptions = ({ navigation }) => ({
    title: '团队列表',
    headerRight: (
      <Text
      style={styles.saveTriggerStyle}
      onPress={() => navigation.state.params.handleCheck()}>添加</Text>
    )
  });

  static componentDidMount() {
  }

  render() {
    return <TeamSetting {...this.props} />;
  }
}

const mapStateToProps = (state) => {
  const { team, user } = state;
  return {
    team,
    user
  };
};

const mapDispatchToProps = (dispatch) => {
  const teamActions = bindActionCreators(teamCreators, dispatch);
  
  return {
    teamActions
  };
}; 

const styles = StyleSheet.create({
  saveTriggerStyle: {
    color: 'white', 
    padding: 10, 
    fontSize: 16, 
    fontWeight: 'bold'
  }
});

export default connect(mapStateToProps, mapDispatchToProps)(TeamSettingContainer);
